﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <title>绵阳市涪城区地方税务局定期定额纳税户电子评税系统</title>
    <link href="style/def/index.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery.min.js" type="text/javascript"></script>
    <script src="js/jquery.tools.min.js" type="text/javascript"></script>
    <script src="js/app.js" type="text/javascript"></script>
</head>
<body>
    <div class="main">
        <div class="top">
        </div>
        <div class="middle">
            <div class="center">
                <div class="login">
                    <div class="input user">
                        代码
                        <input type="text" id="username" maxlength="11" />
                    </div>
                    <div class="input pass">
                        密码
                        <input type="password" id="password" />
                    </div>
                    <div class="buttons">
                        <div class="ok_button">
                            登 录
                        </div>
                        <a href="javascript:forget()">忘记密码</a>
                    </div>
                </div>
            </div>
        </div>
        <div class="bottom">
        </div>
    </div>
    <div class="popup_message">
        <div>
            正在登录，请稍候...
        </div>
        <div style="margin-top: 10px">
            <img src="style/def/index/waiting.gif" border="0" />
        </div>
    </div>
    <div class="warning_ie6">
        <div>
            您正在使用Internet Explorer <span id="iever"></span>，</div>
        <div>
            但本系统需要您使用Internet Explorer 7.0以上版本才能正常运行。</div>
        <div>
            请升级您的Internet Explorer或使用Chrome等其它浏览器。</div>
    </div>
    <script type="text/javascript">
        (function (window) {
            window.forget = function () {
                alert("系统目前尚不支持自助恢复密码功能，请联系管理员重置密码。");
            };

            $("a").each(function () {
                this.hideFocus = true;
            });

            $("#username").keypress(function (e) {
                if ($(this).val() === "") {
                    return;
                }
                if (e.keyCode === 13) {
                    $("#password").focus();
                }
            }).blur(function () {
                var code = $.trim($(this).val());
                if (code.length == 4) {
                    code = "2510703" + code;
                }
                $("#username").val(code);
            }).keydown(function (e) {
                if (isCtrlKey(e.keyCode)) {
                    return true;
                }

                return /\d/.test(keyChar(e));
            });

            $("#password").keypress(function (e) {
                if (e.keyCode === 13) {
                    $(".ok_button").click();
                }
            });

            var verify = function () {
                if ($("#username").val().length != 11) {
                    alert("代码长度不正确，请输入11位税务人员代码或4位简码。")
                    return false;
                }
                return true;
            }

            // 确定按钮
            $(".ok_button").click(function () {
                if (!verify()) {
                    return;
                }

                var username = $("#username").val();
                var password = $("#password").val();
                $(":input").blur();

                var overlay = $(".popup_message").overlay({
                    api: true,
                    speed: "fast",
                    closeOnEsc: true,
                    closeOnClick: false,
                    top: "center",
                    expose: {
                        color: "#E1EEF9",
                        opacity: 0.9,
                        loadSpeed: "fast",
                        closeSpeed: "fast"
                    }
                }).load();

                app.ajaxXml("core/bll/税务机关和人员.ashx", {
                    "fi_act": "Login",
                    "税务人员代码": username,
                    "密码": password,
                    "_R": Math.random()
                }, function (xml) {
                    var $xml = $(xml);
                    if (!$xml || $xml.find("code").text() !== "0") {
                        setTimeout(function () {
                            alert("登录失败");
                            overlay.close();
                            $("#password").focus().select();
                        }, 1000);
                    } else {
                        window.location.href = "app.html";
                    }
                });
            });
        })(window);

        (function (jQuery) {
            var $ = jQuery;
            $(function () {
                if (!!$.browser.msie) {
                    if ($.browser.version < 7.0) {
                        $(".warning_ie6 span#iever").text($.browser.version);
                        $(".warning_ie6").disableSelect().overlay({
                            api: true,
                            speed: "fast",
                            top: "center",
                            expose: {
                                color: "#114A83",
                                opacity: 0.9,
                                loadSpeed: "fast",
                                closeSpeed: "fast"
                            }
                        }).load();
                    }
                }

                if ($("#username").val() === "") {
                    $("#username").focus();
                } else if ($("#password").val() === "") {
                    $("#password").focus();
                }
            });
        })(jQuery);
    </script>
</body>
</html>
